import json

import pandas as pd


path = r"D:\Project\multimoding\data\暗语词典.xlsx"
res_txt = r"D:\Project\multimoding\project\CLIP\classify\assest\argot.txt"
res_json = r"D:\Project\multimoding\project\CLIP\classify\assest\translation.json"
vocabulary = {}

df = pd.read_excel(path)

for i in range(0, len(df)):
    argot, interpret = df.loc[i]
    vocabulary[argot] = interpret

with open(res_txt, 'w', encoding='utf-8') as fp:
    for data in vocabulary.keys():
        fp.write(data + '\n')

with open(res_json, 'w', encoding='utf-8') as fp:
    json.dump(vocabulary, fp)
